module Projects::Index::StagesHelper
  # 刷新阶段
  def remote_function_to_reload_stage_in_project_index(stage)
    remote_function :update => "stage_info_#{stage.id}",
      :url => stage_url(stage),
      :method => :get
  end

  # 刷新阶段s
  def remote_function_to_reload_project_stages_in_project_index(project, options = {})
    options = {
      :update => "project_#{project.id}_stages",
      :url => stages_url(:project_id => project.id),
      :method => :get,
      :with => "'&paying=' + getValue('project_#{project.id}_paying') + '&paused=' + getValue('project_#{project.id}_paused') + '&payed=' + getValue('project_#{project.id}_payed')",
    }.merge options
    remote_function options
  end

  def only_payings?
    params[:pay_status] == 'paying'
  end

  def only_pauseds?
    params[:pay_status] == 'paused'
  end

  def only_payeds?
    params[:pay_status] == 'payed'
  end

  def show_or_hide?(pay_status)
     (params[:pay_status].present? and pay_status != params[:pay_status])
  end

end
